/*
 * 拍品费率
 * @Author: linzy
 * @Date: 2023-07-05
 */
import { useModalForm } from "@/hooks";
import { useEffect } from "react";

export default props => {
  const {
    value,
    onChange,
    visible,
    title,
    formItemProps,
    onCancel,
    loading
  } = props;
  const modalItems = [
    {
      initialValue: value,
      name: "weight",
      type: "inputNumber",
      required: true,
      ...formItemProps
    }
  ];
  const [ModalForm, modalFormProps, setVisible] = useModalForm({
    loading,
    title,
    modalItems,
    onSubmit({ weight }) {
      onChange && onChange(weight);
    }
  });
  useEffect(() => {
    setVisible(visible);
  }, [visible]);
  return <ModalForm {...modalFormProps} onCancel={onCancel} />;
};
